import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

import Chart from "../view/chart/index.vue";
import Layout from "../view/layOut/index.vue";
const routes: Array<RouteRecordRaw> = [
  // {
  //   path: "/",
  //   redirect: "/layout",
  // },
  {
    path: "/",
    name: "home",
    component: () => import("@v/home/index.vue"),
  },
  {
    path: "/home2",
    name: "home2",
    component: () => import("@v/home2/index.vue"),
  },
  {
    path: "/chart",
    name: "chart",
    component: Chart,
  },

  {
    path: "/popUp",
    name: "popUp",
    component: () => import("@v/popUp/index.vue"),
  },
  {
    path: "/detect",
    name: "detect",
    component: () => import("@v/detect/index.vue"),
  },
  {
    path: "/lightUp",
    name: "lightUp",
    component: () => import("@v/lightUp/index.vue"),
  },
  {
    path: "/lightUpRight",
    name: "lightUpRight",
    component: () => import("@v/lightUpRight/index.vue"),
  }, // temperatureAutomatic
  {
    path: "/temperatureAutomatic",
    name: "temperatureAutomatic",
    component: () => import("@v/temperatureAutomatic/index.vue"),
  },
  {
    path: "/layout",
    name: "layout",
    component: Layout,
    redirect: "/findList",
    children: [
      {
        path: "/findList",
        name: "FindList",
        component: () => import("@v/findList/index.vue"),
      },
      {
        path: "/dashboard",
        name: "Dashboard",
        component: () => import("@v/dashBoard/index.vue"),
      },
      {
        path: "/listenList",
        name: "ListenList",
        component: () => import("@v/listenList/index.vue"),
      },
      {
        path: "/publishWork",
        name: "PublishWork",
        component: () => import("@v/publishWork/index.vue"),
      },
      {
        path: "/sortList",
        name: "SortList",
        component: () => import("@v/sortList/index.vue"),
      },
      {
        path: "/studentList",
        name: "StudentList",
        component: () => import("@v/studentList/index.vue"),
      },
      {
        path: "/about",
        name: "About",
        component: () => import("@v/about/index.vue"),
      },
      {
        path: "/mars3d",
        name: "Mars3d",
        component: () => import("@v/mars3d/index.vue"),
      },
    ],
  },
  // 匹配 404 页面
  {
    path: "/:pathMatch(.*)",
    name: "notFound",
    component: () => import("@v/notFound/index.vue"),
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});
export default router;
